package org.csmzxy.class2333;


class Person1 {
    public String name;
    public String role;
    public String subject;
    //构造方法一
    public Person1(String name,String role){
        this.name=name;
        this.role=role;
    }
    public Person1(String name,String role,String subject){
        this.name=name;
        this.role=role;
        this.subject=subject;
    }
    public void print1(){
        System.out.println("姓名"+name+" ");
        System.out.println("身份"+role+" ");
        System.out.println("教学科目"+subject);
    }
}

public class Example06 {
    public static void main(String[] args){
        //创建一个学生对象
        Person1 student =new Person1("小明","学生");
        student.print1();
        Person1 teacher = new Person1("大张伟","老师","音乐");
        teacher.print1();
    }
}
